package com.sunedai.tiger.web.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.view.UrlBasedViewResolver;
import org.springframework.web.servlet.view.tiles3.TilesConfigurer;
import org.springframework.web.servlet.view.tiles3.TilesView;
import org.springframework.web.servlet.view.tiles3.TilesViewResolver;

/**
 * tiles框架配置
 * @author zhaolipeng
 */
@Configuration
public class TilesConfig {

  @Bean
  public TilesConfigurer tilesConfigurer(){
    final TilesConfigurer tilesConfigurer = new TilesConfigurer();
    tilesConfigurer.setDefinitions("/WEB-INF/tiles.xml");
    tilesConfigurer.setCheckRefresh(true);
    return tilesConfigurer;
  }

  @Bean
  public UrlBasedViewResolver tilesViewResolver() {
    final TilesViewResolver resolver = new TilesViewResolver();
    resolver.setViewClass(TilesView.class);
    return resolver;
  }
}
